package java_thinking.unit_15._15_11;

/**
 * @Description :
 * @author: cww
 * @DateTime: 2019-04-07 15:22
 */

class ComparablePet implements Comparable<ComparablePet> {
    @Override
    public int compareTo(ComparablePet o) {
        return 0;
    }
}

// The interface Comparable cannot be implemented more than once with different
// arguments: Comparable<ComparablePet> and Comparable<Cat>
//编译无法通过，一旦为Comparable确定了ComparablePet参数，那么其他任何实现类都不能与ComparablePet
//之外的任何对象比较
/*class Cat extends ComparablePet implements Comparable<Cat> {
    @Override
    public int compareTo(Cat arg){
        return 0;
    }
}*/

class Dog extends ComparablePet {
    @Override
    public int compareTo(ComparablePet o) {
        return super.compareTo(o);
    }
}

/**
 * 这个例子再次说明实现ComparablePet中相同接口是可以的，只要接口精确的相同，包括类型参数在内
 */
class Hamster extends ComparablePet implements Comparable<ComparablePet>{
    @Override
    public int compareTo(ComparablePet arg){
        return 0;
    }
}